﻿using OpenAuth.Domain.Core;
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenAuth.Repository.Models.Mapping
{
    public class OrganizeMap : EntityTypeConfiguration<Organize>
    {
        public OrganizeMap()
        {
            // table
            ToTable("Organize", "dbo");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                .HasColumnName("Id")
                .IsRequired();
            Property(t => t.CascadeId)
                .HasColumnName("CascadeId")
                .HasMaxLength(255)
                .IsRequired();
            Property(t => t.Name)
                .HasColumnName("Name")
                .HasMaxLength(255)
                .IsRequired();
            Property(t => t.Code)
             .HasColumnName("Code")
             .HasMaxLength(255)
             .IsRequired();
            Property(t => t.Status)
                .HasColumnName("Status")
                .IsRequired();
            Property(t => t.SortNo)
                .HasColumnName("SortNo")
                .IsRequired();

            Property(t => t.ParentId)
                .HasColumnName("ParentId")
                .IsOptional();

            // Relationships
        }
    }
}
